<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%--
  Created by IntelliJ IDEA.
  User: csnf
  Date: 2024/12/26
  Time: 08:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
<form action="getCourseByName" method="get">
    <input type="text" name="name">
    <input type="submit" value="搜索">
</form>
<table border="1">
    <tr>
        <td>编号</td>
        <td>课程名称</td>
        <td>章节数量</td>
        <td>开始时间</td>
        <td>结束时间</td>
        <td>教师</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${courseList}" var="cour">
        <tr>
            <td>${cour.id}</td>
            <td>${cour.name}</td>
            <td>${cour.count}</td>
            <td>${cour.startDate}</td>
            <td>${cour.endDate}</td>
            <td>${cour.teacher}</td>
            <td>
                <button onclick="del(${cour.id})">删除</button>
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="7">
            <a href="addCourse.jsp">添加</a>
        </td>
    </tr>

</table>
<script>
    function del(id) {
        if (confirm("确定删除吗？")){
            location.href = "deleteCourse?id="+id;
        }
    }
</script>
</body>
</html>